import React, { Component } from 'react'
import { inject, observer } from 'mobx-react';
import Top from '../components/top'
import Ajax from '../lib/Ajax'

@inject('appStore', 'languageStore')
@observer
class ModuleName extends Component {
	constructor(props) {
    super(props);
    this.state = {

    }
  }

  componentDidMount(){

  }

  signin = () => {
    const self = this;
    Ajax({
      url: '/punch/sign',
      success: function(result){
        self.props.appStore.signin(true);
      },
      error: function(error){
        Toast.info(error||'请求失败');
      }
    });
  }

  render() {
    const signinData = this.props.languageStore.getPageData('signin');
    const { isSignined } = this.props.appStore;
    return (
    	<div>
        <Top
          title={signinData.title}
        />
        <div className="sign-in">
          <div className="t">
            <span className="fr">{ signinData.msgText3 }100{ signinData.msgText4 }</span>
            { signinData.msgText1 }125{ signinData.msgText2 }
          </div>
          <div className="center">
            <a href="javascript:;" className="btn" onClick={ this.signin }>{ isSignined?signinData.btnText2:signinData.btnText1 } +1</a>
          </div>
        </div>
    	</div>
    )
  }
}

module.exports = ModuleName
